﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Collections;
using System.Data;
using CE.Database;

/// <summary>
/// Summary description for HFSelectedItemDB
/// </summary>
/// 
namespace CE.HomeRefinancing
{
    public class HFSelectedItemDB
    {
        public HFSelectedItemDB()
        {
            //
            // TODO: Add constructor logic here
            //
        }

        public Int64 Insert(HFSelectedItem hfselecteditem)
        {
            MyDatabase _db = new MyDatabase();
            Int64 _result = -1;
            string _spName = "sprocHFSelectedItemsInsertSingleItem";

            SortedList _sPara = new SortedList();

            _sPara.Add("@HFSelectedListId", hfselecteditem.HFSelectedListId);
            _sPara.Add("@HFID", hfselecteditem.HFId);
            _sPara.Add("@RefCEUserId", hfselecteditem.RefCEUserId);
            _sPara.Add("@SelectItemId1", hfselecteditem.SelectedItemId1);
            _sPara.Add("@SelectItemId2", hfselecteditem.SelectedItemId2);
            _sPara.Add("@SelectItemId3", hfselecteditem.SelectedItemId3);
            _sPara.Add("@SelectItemId4", hfselecteditem.SelectedItemId4);
            _sPara.Add("@SelectItemId5", hfselecteditem.SelectedItemId5);
            _sPara.Add("@SelectItemId6", hfselecteditem.SelectedItemId6);
            _sPara.Add("@SelectItemId7", hfselecteditem.SelectedItemId7);
            _sPara.Add("@SelectItemId8", hfselecteditem.SelectedItemId8);
            _sPara.Add("@SelectItemId9", hfselecteditem.SelectedItemId9);
            _sPara.Add("@SelectItemId10", hfselecteditem.SelectedItemId10);
            _sPara.Add("@SelectItemId11", hfselecteditem.SelectedItemId11);
            _sPara.Add("@SelectItemId12", hfselecteditem.SelectedItemId12);
            _sPara.Add("@SelectItemId13", hfselecteditem.SelectedItemId13);
            _sPara.Add("@SelectItemId14", hfselecteditem.SelectedItemId14);
            _sPara.Add("@SelectItemId15", hfselecteditem.SelectedItemId15);
            _sPara.Add("@SelectItemId16", hfselecteditem.SelectedItemId16);
            _sPara.Add("@SelectItemId17", hfselecteditem.SelectedItemId17);
            _sPara.Add("@SelectItemId18", hfselecteditem.SelectedItemId18);
            _sPara.Add("@SelectItemId19", hfselecteditem.SelectedItemId19);
            _sPara.Add("@SelectItemId20", hfselecteditem.SelectedItemId20);
            _sPara.Add("@ViewedDetailId", hfselecteditem.ViewedDetailId);
            _sPara.Add("@Status", hfselecteditem.HFStatus == true ? 1 : 0);
            _sPara.Add("@Info1", hfselecteditem.HFInfo1);
            _sPara.Add("@Info2", hfselecteditem.HFInfo2);
            _sPara.Add("@Info3", hfselecteditem.HFInfo3);
            _sPara.Add("@Info4", hfselecteditem.HFInfo4);
            _sPara.Add("@Info5", hfselecteditem.HFInfo5);

            _result = _db.ExecuteSP(_spName, _sPara);

            return _result;
        }

        public void Delete(HFSelectedItem hfselecteditem)
        {
            MyDatabase _db = new MyDatabase();
            string _spName = "sprocHFSelectedItemsDeleteItem";
            SortedList _sPara = new SortedList();
            _sPara.Add("@HFID", hfselecteditem.HFId);
            _db.ExecuteSP(_spName, _sPara);
        }

        public DataTable GetHFSelectedItemImageList(Int64 HFId)
        {
            DataTable _ccselectedcardimage = null;
            MyDatabase _db = new MyDatabase();
            string _spName = "sprocHFSelectedItemsImageItemList";

            SortedList _spara = new SortedList();
            _spara.Add("@HFID", HFId);

            using (DataTable _dt = _db.GetDataTableBySP(_spName, _spara))
            {
                if (_dt != null && _dt.Rows.Count > 0)
                {
                    _ccselectedcardimage = _dt;
                }
            }
            return _ccselectedcardimage;
        }

    }
}